def mochila(C,k):
	M=[True]+[False]*k
	for i in range(len(C)):
		for j in reversed(range(k+1)):
			M[j]=M[j] or M[j-C[i]]
		print ''.join([x and '#' or '_' for x in M])
		if M[k]: return True
	return M[k]

print mochila([1,2,3,4,5,6],7)
